import request from '@/utils/request';
import { stringify } from 'qs'

// 角色管理查询分页
export async function queryPage(params) {
  return request(`/blade-system/erprole/page?${stringify(params)}`);
}

// 角色管理新增
export async function addRole(params) {
  return request('/blade-system/erprole/add', {
    method: 'POST',
    data: params
  });
}

// 角色管理编辑
export async function updateRole(params) {
  return request('/blade-system/erprole/udpate', {
    method: 'POST',
    data: params
  });
}

// 全部菜单数据
export async function getGrantTreeData() {
  return request(`/blade-system/erpmenu/grant-tree-back`);
}

// 当前角色的菜单数据
export async function getGrantTreeDetail(params) {
  return request(`/blade-system/erpmenu/role-tree-back-keys?${stringify(params)}`);
}

// 删除角色
export async function deleteRole(params) {
  return request(`/blade-system/erprole/remove?${stringify(params)}`, {
    method: 'POST'
  });
}
